#include <stdlib.h>
#include <iostream>
#include <iostream>
#include <gmp++/gmp++.h>



int main(int argc, char ** argv) {

  long ni=100,nj=100;
  int bit_size=30;
  int offset = 0;
		    
	 if (argc > ++offset)
	          ni = atoi( argv[offset] );
	 if (argc > ++offset)
	       nj = atoi( argv[offset] );
	 if (argc > ++offset)
	   bit_size = atoi( argv[offset] );
				        
	 long tmp;
	 std::cout<<ni<<" "<<nj<<" M"<<std::endl;
	 for (long i = 0; i < ni; ++i) 
	   for (long j = 0; j < nj; ++j){
	     std::cout<<i+1<<" "<<j+1<<" "<<Integer::random(bit_size)<<std::endl;
	   }

	 printf("0 0 0\n");

return 0;
}
